{% macro render_inline(udoc, avatar=true, badge=true, modbadge=true,
levelbadge=true) %} {% if udoc %}
<span class="user-profile-link">
  {% if avatar %}
  <img
    class="small user-profile-avatar v-center"
    loading="lazy"
    src="{{ avatarUrl(udoc.avatar|default('')) }}"
    width="20"
    height="20"
  />
  {% endif %}
  <a
    class="user-profile-name uname--lv{{ udoc.level|default(0) }}"
    href="{{ url('user_detail', uid=udoc._id) }}"
  >
    {% if handler.user.hasPerm(perm.PERM_VIEW_DISPLAYNAME) and udoc.displayName
    and udoc.displayName != udoc.uname %} {{ udoc.displayName }} ({{ udoc.uname
    }}) {% else %} {{ udoc.uname }} {% endif %}
  </a>
  {% if badge %} {% if udoc.badge %} {% set _badge = udoc.badge.split('#') %}
  <span
    class="user-profile-badge v-center"
    style="background-color:#{{ _badge[1] }}{% if _badge[2] %};color:#{{ _badge[2] }}{% endif %}"
    >{{ _badge[0] }}</span
  >
  {% endif %} {% if levelbadge and udoc.level %} {% set level = udoc.level %}
  <a
    class="user-profile-badge v-center badge--lv{{ level }}"
    href="{{ url('user_detail', uid=udoc._id) }}"
    data-tooltip="{{ _('LV '+ level) }}: Top {{ model.builtin.LEVELS[level]|default('N/A') }}%"
    >{{ _('LV '+ level) }}</a
  >
  {% endif %} {% if modbadge %} {% if udoc.hasPriv(PRIV.PRIV_MOD_BADGE) %}
  <span
    class="user-profile-badge v-center badge--su"
    data-tooltip="{{ _('SuperUser') }}"
    >SU</span
  >
  {% elif udoc.hasPerm(perm.PERM_MOD_BADGE) %}
  <span
    class="user-profile-badge v-center badge--mod"
    data-tooltip="{{ _('Moderator') }}"
    >MOD</span
  >
  {% endif %} {% endif %} {% endif %}
</span>
{% else %}
<span class="user-profile-link">
  {% if avatar %}
  <img
    class="small user-profile-avatar v-center"
    src="{{ UiContext.cdn_prefix }}img/avatar.png"
    width="20"
    height="20"
  />
  {% endif %}
  <a class="user-profile-name" href="#"> {{ _('Unknown User') }} </a>
  {% if badge %}
  <a class="user-profile-badge v-center badge--lv0" href="#" title="LV0"
    >LV 0</a
  >
  {% endif %}
</span>
{% endif %} {% endmacro %}
